from tkinter import * from tkinter.messagebox import * def show(): showinfo("Information","Informative message") showerror("Error", "Error message") showwarning("Warning","Warning message") win=Tk() win.geometry("150x250") btn=Button(win,text="Show",command=show) btn.pack() win.mainloop()
from tkinter import * from tkinter.messagebox import * def show(): res=askyesno("Delete","Are You Sure ?") if res==True: showinfo("Delete","Kar Deya") win=Tk() win.geometry("150x250") btn=Button(win,text="Delete",command=show) btn.pack() win.mainloop()
from tkinter import * from tkinter.simpledialog import * def show(): answer = askstring("Input", "What is your first name?") if answer is not None: print("Your first name is ", answer) else: print("You don't have a first name?") win=Tk() win.geometry("150x250") btn=Button(win,text="Show",command=show) btn.pack() win.mainloop()
Your first name is Amit